import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';

export class BlogLocaleItem {
  @ApiProperty({
    description: '语种标题',
    type: String,
  })
  title: string;

  @ApiProperty({
    description: '主图',
    type: String,
  })
  mainPic: string;

  @ApiProperty({
    description: '内容',
    type: String,
  })
  content: string;
}

export class BlogLocales {
  @ApiProperty({
    description: '英文对应的内容',
    type: BlogLocaleItem,
  })
  @Type(() => BlogLocaleItem)
  en: BlogLocaleItem;

  @ApiProperty({
    description: '中文对应的内容',
    type: BlogLocaleItem,
  })
  @Type(() => BlogLocaleItem)
  zh: BlogLocaleItem;

  @ApiProperty({
    description: '繁体对应的内容',
    type: BlogLocaleItem,
  })
  @Type(() => BlogLocaleItem)
  tc: BlogLocaleItem;
}

export class CreateBlogDto {
  @ApiProperty({
    description: '语种',
    type: String,
  })
  lang: string;

  @ApiProperty({
    description: '内容',
    type: BlogLocales,
  })
  @Type(() => BlogLocales)
  content: BlogLocales;
}
